package com.seu.nic.component.config;

import org.springframework.context.annotation.Configuration;

@Configuration
//@MapperScan(basePackages = "com.seu.component.hr.mapper", sqlSessionTemplateRef = "firstSqlSessionTemplate")
public class DataSourceConfigFirst {


//    @Bean(name = "firstDataSource")
//    @Primary
//    @ConfigurationProperties(prefix = "spring.datasource.first")
//    public DataSource primaryDataSource() {
//        HikariDataSource hikariDataSource = new HikariDataSource();
//        return hikariDataSource;
//    }

//    @Bean(name = "firstDataSourceFactory")
//    @Primary
//    public SqlSessionFactory firstDataSourceFactory(@Qualifier("firstDataSource") DataSource dataSource) throws Exception {
//        MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
//        bean.setDataSource(dataSource);
//        Resource[] resourceBase = new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*.xml");
//        bean.setMapperLocations(resourceBase);
//        return bean.getObject();
//    }

//if you need
//    @Bean(name = "firstTransactionManager")
//    @Primary
//    public DataSourceTransactionManager firstTransactionManager(@Qualifier("firstDataSource") DataSource dataSource) throws Exception {
//        return new DataSourceTransactionManager(dataSource);
//    }


//    @Bean(name = "firstSqlSessionTemplate")
//    @Primary
//    public SqlSessionTemplate firstSqlSessionTemplate(@Qualifier("firstDataSourceFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
//        return new SqlSessionTemplate(sqlSessionFactory);
//    }

}